'use strict';

module.exports = {
  up: async (queryInterface, Sequelize) => {
    /*
      Add altering commands here.
      Return a promise to correctly handle asynchronicity.

      Example:
      return queryInterface.createTable('users', { id: Sequelize.INTEGER });
    */
    const { INTEGER, STRING, DATE, NOW, TEXT } = Sequelize;
    await queryInterface.createTable('l_role', {
      role_id: {
        type: STRING,
        primaryKey: true,
        unique: true,
      },
      role_name: STRING,
      describe: STRING,
      status: {
        type: INTEGER,
        defaultValue: 1,
      },
      creator_id: STRING,
      create_at: {
        type: DATE,
        defaultValue: NOW,
      },
      deleted: {
        type: STRING,
        defaultValue: 0,
      },
      permissions: TEXT,
    });
  },

  down: async (queryInterface, Sequelize) => {
    /*
      Add reverting commands here.
      Return a promise to correctly handle asynchronicity.

      Example:
      return queryInterface.dropTable('users');
    */
    await queryInterface.dropTable('l_role');
  },
};
